<h2>Extend Loan</h2>
<div class="errorval"><?php echo validation_errors(); ?>
<?php echo $error; ?></div>
<!-- Loan information -->
<p>To extend a loan, enter the Accession Number of the loan below.</p>
<p>NB: A valid Accession Number must be provided for the submit button to be enabled.</p>
<center>
<table>
<?php echo form_open('staff/loan_management/extendLoan/'); ?>
<tr>
	<th align="right" width=30%>Accession Number:</th>
	<td><?php echo form_input('access_id', set_value('access_id')); ?></td>
</tr>
<tr>
	<td colspan="3">
		<p name="volume">Please enter accession number of item.</p>
	</td>
</tr>
<tr>
	<th align="right" class="tablehead">Actions</th>
	<td><?php echo form_submit('', 'Submit'); ?></td>
</tr>
<?php echo form_close(); ?>
</table>

</center>

<script type="text/javascript">
$(document).ready(function() {
		$("input[type=submit]").attr("disabled", true);
	
		$("[name=access_id]").keyup( function(){
			$.post('<?php echo site_url('staff/jquery/getLoanDetails'); ?>', $("[name=access_id]").serialize(), function(data) {
				if (data)
				{
					$('[name=volume]').html(data);
					$("input[type=submit]").attr("disabled", false);
				}
				else
				{
					$('[name=volume]').html('Invalid Accession Number or Item not on loan.');
					$("input[type=submit]").attr("disabled", true);
				}
			});
		});
});
</script>